<template>
	<view class="brand-page">
		<van-nav-bar title="品牌详情" left-text="返回" left-arrow @click-left="Back" />

		<view class="list-wrap">
			<!-- 空状态 -->
			<van-empty image="search" description="未找到搜索内容" v-if="show" />
			<view class="item" v-for="v in brands">
				<img :src="v.photo">
				<view class="info">
					<h3>{{v.carName}}</h3>
					<p>
						<text>指导价</text>
						<text class="price">￥ {{v.price}} - {{v.price+15000}}</text>
					</p>
					<text>车型评分{{random.float(1.0, 10).toFixed(1) * 1
}}</text>
				</view>
			</view>

		</view>


	</view>
</template>random.float(1.0, 5.0).toFixed(1) * 1


<script setup>
	import qs from 'qs'
	import random from 'random'
	import $api from '../../request/index.js'
	import {
		ref
	} from 'vue'
	import {
		onShow,
		onLoad
	} from '@dcloudio/uni-app'

	let show = ref(false)
	let type = ''
	let brands = ref([])

	onLoad((payload) => type = payload)
	onShow(() => {
		$api.get('/moto/car/findCar?' + qs.stringify(type)).then(res => {
			show.value = res.data.length > 0 ? false : true
			brands.value = res.data
		})

	})


	const Back = () => uni.navigateBack()
</script>

<style>
	.item {
		display: flex;
		padding: 40rpx 0 40rpx 40rpx;
		border-bottom: 1rpx solid #eee;
	}

	h3 {
		padding: 10rpx 0;
	}

	text {
		font-size: 14px;
		color: #999999;
	}

	.price {
		color: #FE4B3A;
		font-size: 36rpx;
		font-weight: bolder;
	}


	.item>img {
		width: 200rpx;
		height: 150rpx;
		margin-right: 20rpx;
	}
</style>